<?php

class Usuario_Model extends CI_Model {

    function __construct() {
        parent::__construct();
    }

    function isUser($username, $password) {
        $cad = "SELECT c.idCliente idCliente
                FROM Cliente c
                WHERE c.username='" . $username . "' and c.password='" . $password . "' and c.esUsuario='1'";
        $sql = $this->db->query($cad);
        if ($sql->num_rows() > 0) {
            $row = $sql->row();
            return $row->idCliente;
        } else {
            return "-1";
        }
    }

    function getUserData($idUsuario) {
        $cad = "SELECT c.idCliente idCliente, c.nombres nombres, c.apellidos apellidos, c.tipoDocumento tipoDocumento, c.numeroDocumento numeroDocumento, c.username username
                FROM Cliente c
                WHERE c.idCliente='" . $idUsuario. "'";
        $sql = $this->db->query($cad);
        if ($sql->num_rows() > 0) {
            $row = $sql->row();
            return $row;
        }
    }

}